/*
 * @Author: Broin
 * @Date: 2021-11-09 09:45:35
 * @LastEditTime: 2022-01-12 10:35:19
 * @LastEditors: your name
 * @Description: 
 * @FilePath: /myCore/os/src/lang_items.rs
 * MADE BY BROIN
 */

//  use core::panic::PanicInfo;

//  #[panic_handler]
//  fn panic(_info: &PanicInfo) -> ! {
//      loop {}
//  }
// os/src/lang_item.rs
use crate::sbi::shutdown;
use core::panic::PanicInfo;

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
    if let Some(location) = info.location() {
        println!(
            "Panicked at {}:{} {}",
            location.file(),
            location.line(),
            info.message().unwrap()
        );
    } else {
        println!("Panicked: {}", info.message().unwrap());
    }
    shutdown()
}